import request from '@/utils/request'

// 查询零星请购单列表
export function listLqmMstr(query) {
  return request({
    url: '/purchase/lqmMstr/list',
    method: 'get',
    params: query
  })
}

// 查询零星请购单详细
export function getLqmMstr(lqmId) {
  return request({
    url: '/purchase/lqmMstr/' + lqmId,
    method: 'get'
  })
}
// /project/materiel/getImageByWldm/{wldm}
// 查询零星请购单详细
export function getImg(wldm) {
  return request({
    url: '/project/materiel/getImageByWldm/' + wldm,
    method: 'get'
  })
}
// 新增零星请购单
export function addLqmMstr(data) {
  return request({
    url: '/purchase/lqmMstr',
    method: 'post',
    data: data
  })
}

// 修改零星请购单
export function updateLqmMstr(data) {
  return request({
    url: '/purchase/lqmMstr',
    method: 'put',
    data: data
  })
}

// 删除零星请购单
export function delLqmMstr(lqmId) {
  return request({
    url: '/purchase/lqmMstr/' + lqmId,
    method: 'delete'
  })
}

// 根据物料品名查询物料信息
export function searchQF(query) {
  return request({
    url: '/purchase/lqmMstr/searchQF',
    method: 'get',
    params: query
  })
}
// 审核
export function checkLqmMstr(lqmIds) {
  return request({
    url: '/purchase/lqmMstr/checkLqmMstr/' + lqmIds ,
    method: 'put'
  })
}
// 审核-撤回
export function checkBackLqmMstr(lqmIds,reson) {
  return request({
    url: '/purchase/lqmMstr/checkBackLqmMstr/' + lqmIds + '/' + reson ,
    method: 'put'
  })
}

//审核、批准-作废
export function invalidLqm(lqmId, invalidReason) {
  return request({
    url: '/purchase/lqmMstr/invalidLqm/' + lqmId + '/' + invalidReason,
    method: 'put'
  })
}

//批准
export function approveLqmMstr(lqmIds) {
  return request({
    url: '/purchase/lqmMstr/approveLqmMstr/' + lqmIds ,
    method: 'put'
  })
}

// 批准-撤回
export function approveBackLqmMstr(lqmIds,reason) {
  return request({
    url: '/purchase/lqmMstr/approveBackLqmMstr/' + lqmIds +'/'+reason,
    method: 'put'
  })
}

// 请购报表
export function exportLqm(query) {
  return request({
    url: '/purchase/lqmMstr/export',
    method: 'get',
    params:query
  })
}

// 请购报表
export function lqmReportList(query) {
  return request({
    url: '/purchase/lqmMstr/lqmReportList',
    method: 'get',
    params:query
  })
}

// 导出待请购报表
export function exportLqmReport(query) {
  return request({
    url: '/purchase/lqmMstr/exportLqmReport',
    method: 'get',
    params: query
  })
}
